<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>userlist</title>

<script type="text/javascript">
	function getList() {
		
		$.ajax({
			type : "GET",
			url : "${pageContext.request.contextPath}/userlist",
			data : {
				method : "query"
			},
			dataType : "json",//返回的数据类型
 
			success : function(data) {
				alert("1");
 
				var html = '';
				for ( var i = 0; i < data.length; i++) {//循环json对象，拼接tr,td的html
					html = html + '<tr>';
					html = html + '<td>' + data[i].user_id + '</td>';
					html = html + '<td>' + data[i].user_name + '</td>';
					html = html + '<td>' + data[i].user_password + '</td>';
					html = html + '<td>' + data[i].user_type + '</td>';
					html = html + '<td>' + data[i].user_name + '</td>';
					html = html + '<td>' + data[i].user_name + '</td>';
					html = html + '</tr>';
				}
				$('#tr').html(html);//通过jquery方式获取table，并把tr,td的html输出到table中
			},
			error : function() {
				alert("查询失败！");
			}
		});
	}
</script>
</head>
<body>
<table class="table" id="tr" style="text-align: center;">
 
	</table>
</body>
</html>